DefineDatabase Define Database Form1, Frame2 DBF Name DBF_Name NEW.DBF Label7 Data&base name Frame1 Define Fields Fld_Name Label1 Field &Name Fld_Type Combo1 Label2 Field &Type WhichFld Fld_Len Label6 &Field no. Label3 L&ength Fld_Log Fld_Dec Label5 Lo&gical Label4 &Decimals Fields Fields Next_Fld &Next Last_Fld &Last W Clear_Fld &Clear Chk_Fld &Validate Text1 Command1 C&reate Database Command2 E&xit Combo1_Change Combo1 Form_Click Form_LinkClose Form_LinkError LinkErr Form_LinkExecute@ CmdStr Cancel Form_LinkOpen @ Form_Load Form_LostFocus Value SelTextt SelStart Sellength Text1_Change Text1_KeyDown KeyCode" Shift- Text1_KeyPress KeyASCII Focus Text1 SetMAXErrorz MaxErrorMsgQ ErrActionn VerifyField+ DefineDB Text2_Change Text3_Change fldnamee Text1_GotFocus Text1_DragOver` Source State Text1_DragDrop' Text1_KeyUpQ Text1_LinkClose Text1_LinkErrori Text1_LinkOpen3 Text1_LostFocus Command1_Click DefineDatabaseV Command2_Click Frame1_DragDropA CenterWindow} DispDBInfo MousePointer HOURGLASS DEFAULT Combo1_LostFocus Text3 EnabledP FALSE Text4 Text2= HScroll1_Change WhichFldS ThisFld Fields_DragDrop( SelectRecord2 Record[ RecordCount SelFLDz SelFld_Change WhichFld_Changeh Command3_Click Command4_Click ResetFld WhichFld_KeyPress pFldh DoMAXError Label4_Click ListIndex FldInfo RecSize HeadSize OffSet Decimal FType FName LengthG WinWidth Screen Width AnyForm WinHieght Height DisplayFld} SaveFldData SaveFld Fieldo Form_Resize Fld_Name* Fld_Type` Fld_Len Fld_Dec Fld_Log Fld_Type_LostFocus KeyPress Fld_Name_KeyPress< Fld_Dec_ChangeN Fld_Len_Changer Fld_Log_Change DefintDatabase program\ verifiesh user. performs4 entry validation array that) dBASE compatible database@ Fld_Type_Change Next_Fld_Click< Last_Fld_Clickp Next_Fld Count pFldNameo Fld_Name_Change SetFoucs UpDateFldsc Fld_Len_Text Fld_Name_LostFocus VerifyName$ Fld_Type_KeyPress Fld_Name_KeyDown Fld_Type_KeyDown itemsy availableN ListCountJ CheckType MaxErrorM StatusZ VerifyData+ Fld_Name_LinkOpen Fld_Name_LinkError Fld_Name_LinkClose Fld_Name_KeyUp3 Fld_Name_GotFocusp Fld_Name_DragOver Fld_Name_DragDrop Fld_Type_Click\ noteG Fld_Log_GotFocus Fld_Len_LostFocus Fld_Len_LinkOpen Fld_Len_LinkErrorJ Fld_Len_LinkClose_ Fld_Len_KeyUp Fld_Len_KeyPressR Fld_Len_KeyDown Fld_Len_GotFocusT Fld_Len_DragOver1 VerifyType- dummy Del_Fld_Click LastFldd GetLastFld Jumpt statsu Label3_Click Clear_Fld_Click Chk_Fld_Click Changed DBF_Name DBFName FIRST_NAME MaxFlds# MaxxFldsy fldlen fldtype5 DEFDBF ErrorStatus) ProcessMsg PrintMsgE PrintDBFName CreateDataBase OpenDataBase Handle( OpenDBF CloseDBF CreateDBF Recsv Structure@ Utils DispStruce Checked Label1_Click DEFNAME PastFld DBFTYPE8 MultiUser Bufferedn Header NumRecs Fields RecBuf RecordNo RecordDatap NDXBranchM PageL PageR KeyRec KeyVal NDXHeadStrucX RootPage TotalPages& Filler1 KeyLength0 MaxKeysPage KeyType KeyRecSize Filler2 Unique NDXPageStruc NoKeyRecs LastKey= NDXHeadern NDXPage} MAXFIELDS MaxDBFs LANATTEMPTS LANDELAY MODAL MODELESS PROGNAME OpenDBFCountR DEFHandle ClientList Clients NewDbfName follows6 DoDefError Chk_Fld_LostFocuss DeineDatabase SelSlen Frame2_DragDrop ModeControl DBFHandle irIf& Code for Visual Basic 1.0 and Windows 3.0r (C)1991 Marquis Computing. All Rights Reserved. Form DefintDatabasee Gets user input, performs entry validation, verifies structure and buildss a FldInfo type array that may be used by other VBDB^ routines to createe a dBASE* III+ compatible database. ^VBDB(C)1991 Marquis Computing, parts (C)1990 Marquis Computing. VBDB is a tradmark of Marquis Computing.1 *dBASE and dBASE III+ are trademarks of Ashton-Tate. Fld() is an array which carries information to define a database header. The constants are used to make using this easier. Fld() is defined as follows -- Element #: 1 = decimal flag (-1 or 0)) 2 = field length 3 = field type (String * 1) 4 = field name (String * 12) 5 = location of field Form_Load --- center the window --- build combo boxn Character" Numeric" Logical" --- assign 0 valuese --- reset pointer5 Command1_Click Saves database definition into the Fld() type and then create a database. --- copy down other fields --- pointer wait --- create a dbf normal create / open Command2_Click ResetFld Resets the field data for a new field Character" WhichFld_KeyPress set fldt enter key? for VB bug get fld no. in range for DBF?o save current field data display selected field DoMAXError 3006 'set error "invalid field size" DisplayFld Displays a fields data --- figure out field type Character" Logical" Numeric" --- update the basic info regarding this field --- display its data --- set focus to top of form SaveFld Saves a fld definition into position ThisFld of array Fld_Name_KeyPress On enter key, goto next field Next_Fld_Click --- is there another field?i --- assign THIS field type --- determine NEXT field --- display fields datae Last_Fld_Click --- is there another field?b --- save this data --- determine NEXT field --- display next dataa VerifyField Returns -1(-1) if field name is valid otherwize returns FALSE (0) -!@#$%^&*() bad items length --- look for bad items set function FALSE --- check field name for usedl reset count to 0 make a DBF fld name string pad out FldName$ swap 'em name used? set function FALSE name not usedm exit loopu --- if you got here the fld is good Fld_Name_Change Indicate that field info has changed UpDateFlds Updates the conditions of the various boxesb based on the type of box it its. Character"& Date& Logical"& Numeric"& Memo& Fld_Type_KeyPress On enter key, goto next field_ VerifyData Verifies the forms data. If anything is bogus, returns Statust as TRUE (-1) otherwise Status is FALSE (0). --- assume guilt file name invalid"$ --- check for name field name invalid$ --- check names vailidty field name invalid$ --- check field name length field name length invalid"$ --- check field length field length invalid$ --- verify logical field is two characters field length invalid$ Fld_Type_LostFocus Make sure data is correct for this type VerifyType Check type set to no errors on form & exit. GetLastFld Returns the last valid field in a fieldf definition array Clear_Fld_Click Clears out a fields data. If the current field is the last field,i and has data in it, then the data is reset to 0 (character with length 0 and null field name), if the field is already 0, and this is the last fiels, it is erased and focus is given to the next field UNDER this one. get this field no. blow it outs set focus to name. get the last fld no. make up for 0 fld no.d is this the last one? yes, reset ith re-display it with 0 Chk_Fld_Click Verifies a flieds data field definition ok" Validate Fields" Fld_Type_Change Indicate that field info has changed Fld_Len_Change Indicate that field info has changed Fld_Dec_Change Indicate that field info has changed Fld_Log_Change Indicate that field info has changed WhichFld_Change Indicate that field info has changed DoDefError pops up an error message Define Database Error Fld_Name_LostFocus